package io.gitee.zicai.redisson.rpc;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * RedissonRpcProperties
 *
 * @author zicai
 * @since 2021-03-26
 */
@Data
@NoArgsConstructor
@ConfigurationProperties(prefix = "redisson.rpc")
public class RedissonRpcProperties {

    @Value("${spring.application.name:'default'}")
    private String applicationName;

    /**
     * RPC服务名称
     */
    private String remoteServiceName;

    public String getRemoteServiceName() {
        return StrUtil.isBlank(remoteServiceName) ? applicationName : remoteServiceName;
    }
}
